home *** CD-ROM | disk | FTP | other *** search
-
- '┌───────────────────────────────────────────────────────┐
- '│ Written by Jonathan S. Waldman │
- '│ (C) 1989, 1990 Jonathan S. Waldman & Dialog Software │
- '│ (C) Crescent Software. │
- '│ All rights reserved. │
- '└───────────────────────────────────────────────────────┘
-
- '============
- 'DiaLogic
- 'EXAMPLE2.BAS
- '============
-
- '$INCLUDE: 'DIALOGIC.BI' 'include our DiaLogic TYPE definitions
-
- '====================
- 'Initialize the mouse
- '====================
-
- CALL InitMouse(There%) 'see if mouse and driver are there
- IF There% THEN 'if yes then
- CALL ShowCursor 'show the mouse
- CALL TextCursor(0, 4) 'use this to insure mouse is always visible
- END IF
-
- '======
- 'Set-up
- '======
-
- CALL HideCursor 'hide the mouse cursor during CLS & PRINTs
- WIDTH , 25 'insure we're in 25-line mode
- COLOR 15, 1
- CLS 'clear the screen
-
- '========================
- 'REDIM the arrays for now
- '========================
-
- '$DYNAMIC 'make all arrays dynamic
- MaxDBE = 20 'use for our dimension statements
- ' 20 dialog box elements will be our max
- REDIM SHARED DB(2, MaxDBE) AS DialogType 'REDIM these TYPE arrays
- REDIM SHARED LB(0) AS DialogText ' dynamically
-
- '=======================================
- 'Define some convenient string variables
- '=======================================
- PRINT
- PRINT " This is an example of a multi-tasking dialog box."
- PRINT ""
- PRINT " Observe that the time is updated. Also, try selecting <Help>, which"
- PRINT " is inactive, or try selecting <OK>, which will set all dialog box"
- PRINT " elements to specific values. These examples demonstrate that multi-"
- PRINT " tasking dialog boxes can both inactivate and update their dialog box"
- PRINT " elements."
-
- CALL ShowCursor 'show it again
-
- Cancel$ = CHR$(27) 'these are our string assignments, also used
- Help$ = CHR$(0) + CHR$(59) ' in the FIND.DB template.
- OK$ = CHR$(13)
-
- REDIM SHARED DB(2, MaxDBE) AS DialogType 'REDIM these TYPE arrays
- REDIM SHARED LB(10) AS DialogText
- Level% = 1 'set Level% to 1
- '$INCLUDE: 'FIND.DB' 'include Help dialog box template
-
- NotAvailable = 113
- DB(Level%, 11).PrimaryColor = NotAvailable
- DB(Level%, 11).WindowColor = NotAvailable
- DB(Level%, 11).WindowColor = NotAvailable
- DB(Level%, 11).KeyColor = NotAvailable
-
- Action% = 1 'set Action% to 1
- Focus% = 0 'set the input focus to auto -- 0
- CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
- Action% = 3 'set Action to 3 for polling
- ExitLoop = 0 'set ExitLoop flag to false
- DO
- DO
- IF Count% = 75 OR TIMER - OldTime! > .5 THEN 'update time every
- OldTime! = TIMER '1/2 second or every
- LOCATE 19, 13, 0 'time count reaches
- COLOR 1, 7 '75
- PRINT TIME$;
- Count% = 0
- END IF
- CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
- Count% = Count% + 1
- LOOP UNTIL Action% = 4 'wait until a key is pressed
- SELECT CASE Ky$ 'examine command buttons or key
- CASE Cancel$ '<Cancel> was pushed
- Action% = 5 'remove the dialog box
- CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
- ExitLoop = -1 'get out
- CASE Help$ 'ignore it but play a beep first
- PLAY "L64<EC>"
- CASE OK$
- DB(Level%, 2).TextString = "Ok was pressed" 'set dialog box
- DB(Level%, 3).Default = -1 'options to show
- DB(Level%, 4).Default = -1 'on-the-fly
- DB(Level%, 5).Default = 2 'modification
- Action% = 2 'Action 2 refreshes DBEs
- CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
- Action% = 3 'resume polling in the DO loop
- CASE ELSE
- END SELECT
- LOOP UNTIL ExitLoop 'exit when flag is set
- COLOR 7, 0
- CALL HideCursor
- CLS
- END
-
- CloseBox:
- Action% = 5 'subroutine to remove a dialog box
- CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
- RETURN
-
-